<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'insertInformation.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<meta http-equiv="content-type" content="text/html;charset=UTF-8">
	 <link href="css/index.css" rel="stylesheet">
	
  </head>
  <script type="text/javascript">
  var b=0;
   var a=false;
  function nameCheack(){
  document.getElementById("nametip").innerHTML="";
		 name=document.getElementById("name").value;
		if(name==null||name==""){
			document.getElementById("nametip").innerHTML="  乃的名字捏？";
			a=false;
			}else if(name.length>6||name.length<3)
			{
			document.getElementById("nametip").innerHTML="  难道乃是外国人？!";
			a=false;
		}else{
		a=true;
		}

  }
  
  
  	var b=false;
  function typeCheack(){
  document.getElementById("typetip").innerHTML="";
		 type=document.getElementById("type").value;
		if(type==null||type==""){
			document.getElementById("typetip").innerHTML="请输入类别~";
			b=false;
			}else if(type.length>10){
			document.getElementById("typetip").innerHTML="太长了~";
			b=false;
			}else{
			b=true;
			}
 
  		
  }
  
  
   var c=false;
  function placeCheack(){
  document.getElementById("placetip").innerHTML="";
		place=document.getElementById("place").value;
		if(place==null||place==""){
			document.getElementById("placetip").innerHTML="请输入拾取地点~";
			c=false;
			}
			else if(place.length>16){
			document.getElementById("placetip").innerHTML="乃是在地球上捡到的吗？!";
			c=false;
			}else{
			c=true;
			}
  }
  
   var d=false;
    function descCheack(){
  document.getElementById("desctip").innerHTML="";
		desc=document.getElementById("desc").value;
		if(desc==null||desc==""){
			document.getElementById("desctip").innerHTML="详细描述~";
			d=false;
		}else if(desc.length<4){
		document.getElementById("desctip").innerHTML="详细描述~";
		d=false;
		}else{
		d=true;
		}
  }
  
   		var e=false;
   function phoneCheack(){
        document.getElementById("phonetip").innerHTML="";
        phone=document.getElementById("phone").value;
           if(!(/^1[3|4|5|8][0-9]\d{4,8}$/.test(phone))){ 
       document.getElementById("phonetip").innerHTML="11位的手机号~";
          e=false;
           }else if(phone.length!=11){
            document.getElementById("phonetip").innerHTML="11位的手机号~";
            e=false;
           }else{
           e=true;
           }
 
  		}
  
  
  
  	var f=true;
   function qqCheack(){
  document.getElementById("qqtip").innerHTML="";
		qq=document.getElementById("qq").value;
		if(qq==""||qq==null){
		f=true;
		}else if(qq.length>14||qq.length<5){
			document.getElementById("qqtip").innerHTML="靓号不给填呢~";
			f=false;
			}else{
			f=true;
	        }
  
  }
  
  
  	var g=false;
   function keyCheack(){
        document.getElementById("keytip").innerHTML="";
		key=document.getElementById("key").value;
		if(key==null||key==""){
			document.getElementById("keytip").innerHTML="它将作为删除时的依据，请牢记！";
			 g=false;
			}else if(key.length>15){
			document.getElementById("keytip").innerHTML="太长了别人记不住呢~";
			 g=false;
			}else{
			g=true;
			}
  
  
  }
  function cheackAll(){
   if(a&&b&&c&&d&&e&&f&&g){
   		return true;
   }else{
   alert("请将信息填写完整!");
   		return false;
   }
  }
  
  </script>
  
 
  
  <body>
  <br>
  <br>
  <br>
  <div class="warn_div">
  
  如果您拾到了他人的物品，可以在这里提交 ^_^<br><br>
  </div>
  <div style="padding-left:20px">
   <form action="/insertInfo" enctype="multipart/form-data" method="post" onsubmit="return cheackAll()" >
   姓名：<br> <input  type="text" name="name" id="name" style="width:200px" placeholder="必填"  onblur="nameCheack()" /></span><br>
   <div id="nametip" style="color:#f00;font-size:12pt;"></div><br>
  类别：<br>   <input type="text" name="type" id="type" style="width:200px" placeholder="必填" onblur="typeCheack()" ><br>
  <div  id="typetip" style="color:#f00;font-size:12pt;"></div><br>
  拾取地点：<br> <input   type="text" name="place" id="place" style="width:200px" placeholder="必填" onblur="placeCheack()"><br><br>
  <div id="placetip" style="color:#f00;font-size:12pt;"></div><br>
  描述： <br>  <textarea rows="8" cols="10"  style="width:200px" name="describle" placeholder="必填"  id="desc" onblur="descCheack()"></textarea>><br><br> 
  <div id="desctip" style="color:#f00;font-size:12pt;"></div><br>
  手机：<br> <input   type="text" name="phone"  style="width:200px" id="phone" placeholder="必填" onblur="phoneCheack()"><br>
  <div id="phonetip" style="color:#f00;font-size:12pt;"></div><br>
  QQ/微信：<br> <input  type="text" name="qq" style="width:200px" id="qq" placeholder="选填" onblur="qqCheack()"><br>
  <div id="qqtip" style="color:#f00;font-size:12pt;"></div><br>
  口令：<br> <input  type="text" name="key" id="key" style="width:200px" placeholder="必填"  onblur="keyCheack()"><br>
  <div id="keytip" style="color:#f00;font-size:12pt;"></div><br>
  图片上传：<br><input type="file" name="pic" style="width:200px">
  <br><br><br>
  
  <input type="submit" value="提交">
   </form>
   </div>
  </body>
</html>
